package com.zbj.data.jpa.service;

import com.zbj.data.jpa.entity.Student;

import java.util.Collection;
import java.util.Date;
import java.util.List;

/**
 * StudentService
 *
 * @author weigang
 * @create 2017-09-10
 **/
public interface StudentService {

	List<Student> findByName(String name);

	/**
	 *
	 … where x.name = ?1 and x.age = ?2
	 * @param name
	 * @param age
	 * @return
	 */
	List<Student> findByNameAndAge(String name, Integer age);

	/**
	 * … where x.name = ?1 or x.age = ?2
	 * @param name
	 * @param age
	 * @return
	 */
	List<Student> findByNameOrAge(String name, Integer age);

	/**
	 * … where x.age between ?1 and ?2
	 * @param start
	 * @param end
	 * @return
	 */
	List<Student> findByAgeBetween(Integer start, Integer end);

	/**
	 * … where x.age < ?1
	 * @param age
	 * @return
	 */
	List<Student> findByAgeLessThan(Integer age);

	/**
	 * … where x.age <= ?1
	 * @param age
	 * @return
	 */
	List<Student> findByAgeLessThanEqual(Integer age);

	/**
	 * … where x.age > ?1
	 * @param age
	 * @return
	 */
	List<Student> findByAgeGreaterThan(Integer age);

	/**
	 * … where x.age >= ?1
	 * @param age
	 * @return
	 */
	List<Student> findByAgeGreaterThanEqual(Integer age);

	/**
	 * … where x.createDate > ?1
	 * @return
	 */
	List<Student> findByCreateDateAfter(Date createDate);

	/**
	 * … where x.createDate < ?1
	 * @param createDate
	 * @return
	 */
	List<Student> findByCreateDateBefore(Date createDate);

	/**
	 * … where x.age is null
	 * @return
	 */
	List<Student> findByAgeIsNull();

	/**
	 * IsNotNull,NotNull
	 * … where x.age not null
	 * @return
	 */
	List<Student> findByAgeNotNull();

	/**
	 * … where x.name like ?1
	 * @param name
	 * @return
	 */
	List<Student> findByNameLike(String name);

	/**
	 * … where x.name not like ?1
	 * @param name
	 * @return
	 */
	List<Student> findByNameNotLike(String name);

	/**
	 * … where x.name like ?1 (parameter bound with appended %)
	 * @param name
	 * @return
	 */
	List<Student> findByNameStartingWith(String name);

	/**
	 * … where x.name like ?1 (parameter bound with prepended %)
	 * @param name
	 * @return
	 */
	List<Student> findByNameEndingWith(String name);

	/**
	 * … where x.firstname like ?1 (parameter bound wrapped in %)
	 * @param name
	 * @return
	 */
	List<Student> findByNameContaining(String name);

	/**
	 * … where x.name = ?1 order by x.age desc
	 * @param name
	 * @return
	 */
	List<Student> findByNameOrderByAgeDesc(String name);

	/**
	 * … where x.name <> ?1
	 * @param name
	 * @return
	 */
	List<Student> findByNameNot(String name);

	/**
	 * … where x.age in ?1
	 * @param ages
	 * @return
	 */
	List<Student> findByAgeIn(Collection<Integer> ages);

	/**
	 * … where x.age not in ?1
	 * @param ages
	 * @return
	 */
	List<Student> findByAgeNotIn(Collection<Integer> ages);

	/**
	 * … where UPPER(x.firstame) = UPPER(?1)
	 * @param name
	 * @return
	 */
	List<Student> findByNameIgnoreCase(String name);
}
